﻿using UnityEngine;
using System.Collections;
using Lost;

public class OnePath : MonoBehaviour {
	[SerializeField] bool isDraw = true;
	[SerializeField] CurvesType curvesType;
	public Vector3[] Path{get{ return m_path;}}
	[SerializeField] Vector3[] m_path;
	public string PathName = "PathName";
	void Awake(){
		Transform[] temp = GetComponentsInChildren<Transform> ();
		m_path = new Vector3[temp.Length - 1];
		for (int i = 1; i < temp.Length; i++) {
			m_path [i - 1] = temp [i].position;
			//m_path [i - 1] = GetRandomVector (new Vector3 (30f, 30f, 30f));
		}
	}

	Vector3 GetRandomVector(Vector3 range){
		Vector3 result = new Vector3 (Random.Range (-range.x, range.x), Random.Range (-range.y, range.y), Random.Range (-range.z, range.z));
		return result;
	}


	void OnDrawGizmos(){
		Gizmos.color = Color.red;
		if (isDraw) {
			GizmosManager.DrawCurves (m_path, curvesType);
		}
	}
}
